package br.ufmg.vod.wbr.algorithims;

import java.util.Arrays;
import java.util.Collections;
import java.util.Random;

import br.ufmg.vod.collections.ArrayShuffle;
import br.ufmg.vod.wbr.algorithims.bfs.BFSData;
import br.ufmg.vod.wbr.algorithims.dfs.DFSData;
import br.ufmg.vod.wbr.api.Graph;

public class SimulateAtack {
	

	private int[] vertex;
	private final int seed;
	private Random r;

	public SimulateAtack(Graph g, int seed) {
		this.seed = seed;
		this.vertex = new int[g.getNumVertex()];
		for (int i = 0; i < vertex.length; i++) {
			vertex[i]=i;
		}
		this.r = new Random(seed);
	}
	
	public void newAtack(int numAtacked, BFSData data ){
		ArrayShuffle.shuffle(vertex, r);
		for (int i = 0; i < numAtacked; i++) {
			data.colors[vertex[i]] = BFSData.BLACK;
		}
	}
	
	public void newAtack(int numAtacked, DFSData data ){
		ArrayShuffle.shuffle(vertex, r);
		for (int i = 0; i < numAtacked; i++) {
			data.colors[vertex[i]] = BFSData.BLACK;
		}
	}

}
